package tech.dubbo.client.beanDefinition;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import tech.dubbo.api.service.IUserService;
import tech.dubbo.client.factoryBean.InterfacesFactoryBean;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2024/9/28
 */
public class InterfacesBeanDefinition implements ImportBeanDefinitionRegistrar {

    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {


        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition();
        rootBeanDefinition.setBeanClass(InterfacesFactoryBean.class);
        rootBeanDefinition.getPropertyValues().addPropertyValue("interfaces", IUserService.class);

        registry.registerBeanDefinition("userService", rootBeanDefinition);

    }
}
